home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Linux Cubed Series 7: Sunsite
/
Linux Cubed Series 7 - Sunsite Vol 1.iso
/
system
/
shells
/
kiss-0.11
/
kiss-0
/
kiss
/
src
/
dosetenv.c
< prev
next >
Wrap
C/C++ Source or Header
|
1995-03-23
|
657b
|
30 lines
#include "kiss.h"
int dosetenv (Stringstack s)
{
register int
i;
if (getopt (s.nstr, s.str, "h") != -1)
{
warning ("Bad commandline.\n"
"Usage: setenv -h this text\n"
" setenv VAR value set enviroment variable to value\n"
" VAR=value set environment "
"variable to value\n");
return (1);
}
if (s.nstr != 3)
return (warning ("command needs VARIABLE and value\n"));
for (i = 0; i < strlen (s.str [1]); i++)
if (! isupper (s.str [1][i]))
return (warning ("variable \"%s\" is not all upper case\n",
s.str [1]));
addtoenv (s.str [1], s.str [2]);
return (0);
}